<?php

// +----------------------------------------------------------------------
// | EasyAdmin
// +----------------------------------------------------------------------
// | PHP交流群: 763822524
// +----------------------------------------------------------------------
// | 开源协议  https://mit-license.org
// +----------------------------------------------------------------------
// | github开源项目：https://github.com/zhongshaofa/EasyAdmin
// +----------------------------------------------------------------------

namespace app\api\model;

use app\common\model\TimeModel;
use think\facade\Db;
use think\model\Relation;

use think\facade\Request;
class Yjcomm extends TimeModel
{   

    public function __construct(){
      
        $this->url=Request::domain();
    }
 
    //当前日期是否为节假日
    public function getDataDay($time=''){
        $year = date('Y', $time?$time:time());
        $dayOfWeek = date('N', $time?$time:time());
                $holiday = array(
                    date('Y-m-d', strtotime("$year-01-01")), //元旦
                    date('Y-m-d', strtotime("$year-04-05")), //清明节
                    date('Y-m-d', strtotime("$year-04-29")), //劳动节
                    date('Y-m-d', strtotime("$year-04-30")), //劳动节
                    date('Y-m-d', strtotime("$year-05-01")), //劳动节
                    date('Y-m-d', strtotime("$year-05-02")), //劳动节
                    date('Y-m-d', strtotime("$year-05-03")), //劳动节
                    date('Y-m-d', strtotime("$year-06-01")), //儿童节
                    date('Y-m-d', strtotime("$year-06-22")), //端午节
                    date('Y-m-d', strtotime("$year-06-23")), //端午节
                    date('Y-m-d', strtotime("$year-06-24")), //端午节
                    date('Y-m-d', strtotime("$year-09-29")), //国庆节
                    date('Y-m-d', strtotime("$year-09-30")), //国庆节
                    date('Y-m-d', strtotime("$year-10-01")), //国庆节
                    date('Y-m-d', strtotime("$year-10-02")), //国庆节
                    date('Y-m-d', strtotime("$year-10-03")), //国庆节
                    date('Y-m-d', strtotime("$year-10-04")), //国庆节
                    date('Y-m-d', strtotime("$year-10-05")), //国庆节
                    date('Y-m-d', strtotime("$year-10-06")), //国庆节
                   
                );
        if($dayOfWeek == 6 || $dayOfWeek == 7 || in_array($year,$holiday)){
            return true;
        }
        return false;
    }
}
